﻿<%@ page language="java" import="java.util.*,com.stone.business.workcard.pojo.Gxzlkzk_BZ,com.stone.business.workcard.pojo.Gxzlkzk" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
Gxzlkzk gxzlkzk=(Gxzlkzk)request.getAttribute("entity");
boolean dybz=false;
if(gxzlkzk==null||gxzlkzk.getId_sno()==null||gxzlkzk.getId_sno().equals("")||gxzlkzk.getId_sno()==0){
dybz=true;
}
%>

<html>
	<head>	
		<title>工序质量控制卡</title>
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery.autogrow.js"></script> 
		<script type="text/javascript">
			$(document).ready (function() {
		
			$('textarea').autogrow();		
			});		
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				       {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            hidden:<%=session.getAttribute("btn_savegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
				            handler:function(){
				            	comt();
				            }
				        },'-',
						{
				            text: '审核通过',
				            icon:"<%=contextPath%>/" + "images/editlink.gif",
				            hidden:<%=session.getAttribute("btn_shenhe_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,			       
				            handler:function(){
				            	func_sh();
				            }
				        },'-',
				        {
				            text: '标准工序作业模版',
				            icon:"<%=contextPath%>/images/pass.gif",
				            hidden:<%=session.getAttribute("btn_savegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
				            handler:function(){
				            	toNewGx();
				            },
				            disabled:<%=dybz%>
				        },'-',
				        {
				            text: '典型工序质量控制卡',
				            icon:"<%=contextPath%>/images/pass.gif",
				            hidden:<%=session.getAttribute("btn_savegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
				            handler:function(){
				            	toNewModel();
				            },
				            disabled:<%=dybz%>
				        } ,'-',
						{
				            text: '另存为典型工序卡',
				            icon:"<%=contextPath%>/" + "images/save.gif",
				            hidden:<%=session.getAttribute("btn_savegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,			       
				            handler:function(){
				            	func_model();
				            },
				             disabled:<%=dybz%>
				        }/**,'-',
				        {
				            text: '另存为',
				            icon:"<%=contextPath%>/images/save.gif",
				            hidden:<%=session.getAttribute("btn_savegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")) ? false:true%>,
				            handler:function(){
				            	copy();
				            },
				            disabled:<%=dybz%>
				        }*/,'-',
				        {
				            text: '打印',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	print();
				            },
							disabled:<%=dybz%>
				        },'-',
				        {
				            text: '返回',
				            icon:"<%=contextPath%>/images/fanhui.png",
				            handler:function(){
				            	back();
				            }
				        }
			    	]
			    });
			});
			function func_sh(){			
		    	if(confirm("确定要审核通过选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/gxzlkzk!verifyGxzlkzk.do";
					document.frmM.submit();
		    	}
			}
			function print(){			
			var url="<%=contextPath%>/gxzlkzk!updateGxzlkzk.do?directFlag=PRINT_SUCCESS&id=${entity.id_sno}";
			 var win = openSUB(url,2,800,600,50,30);
			}
			function getprojectinfo(){
			window.open("<%=contextPath%>/projectImplement!findByUnitno.do", '统计表格', 'height=800, width=350, top=200, left=300, toolbar=no, menubar=no');
			// document.frmM.action = "<%=contextPath%>/projectImplement!findByUnitno";
			}
			function func_load(){
				var isTZ="${info}";
				if(isTZ=="审核成功!"){
				//window.parent.location.href="<%=contextPath%>/jsp/business/workcard/gzzbTab.jsp?src=gxzlkzkList!getList.do";
				}
			}
		</script>
	</head>
  
  <body topmargin="0" onload="func_load();">
	<div id = "tbar" style="position:absolute;display:block left:0px; top:0px; width:100%; height:35px; z-index:1;"></div>
	<br>
	<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
	
		<!-- 信息提示 -->
		<div id="result" align="center"><font color="red">${info }</font></div>
		<table width="100%" height="30">
			<tr>
				<td colspan="4" align="center">
					<span  style="font: 22pt/22pt 宋体;"><strong><b>工序质量控制卡</b></strong></span>
				</td>
			</tr>
			<tr>
				<td colspan="4" align="right">
					编号：${entity.serial_number}
				
				</td>
			</tr>
		</table>
 		<form id="frmM" class="ct" name="frmM" method="POST" action="<%=contextPath%>/workcardOne!addWorkcardOne.do">
			<input type="hidden" name="entity.serial_number" value="${entity.serial_number}"/>	
			<input type="hidden" name="entity.id_sno" id="entity.id_sno" value="${entity.id_sno}"/>
			<input type="hidden" name="entity.planid" id="entity.planid" value="${entity.planid}"/>
			<input type="hidden" name="entity.cjrid" id="entity.cjrid" value="${entity.cjrid}"/>
			<input type="hidden" name="entity.oc_bxr" id="entity.oc_bxr" value="${entity.oc_bxr}"/>
			<input type="hidden" name="entity.model" id="entity.model" value="${entity.model}"/>
			<input type="hidden" name="id"  value="${entity.id_sno}"/>
			<table width="100%" border="0" id="infotab">
			<tr>		
			<th width="120" nowrap>
						编写人：
			</th>
			<td>
				
				<input type="text" style="width:50%" readonly="true" name="entity.oc_bxr" value="${entity.oc_bxr}" disabled \/>				
				
			</td>
			<td colspan="2" nowrap></td>
			
			</tr>
			<s:if test="entity.oc_status!=\"2\"&&entity.oc_status!=\"\"">
			
			<tr>
			<th width="120" nowrap>
						审核人：
			</th>
			<td>
				
				<input type="text" style="width:50%" readonly="true" id="shr" value="${entity.oc_spr}" disabled />				
				<input type="hidden" style="width:50%" readonly="true" name="entity.oc_spr" value="${entity.oc_spr}" />		
			</td>			
			<th width="120" nowrap>
						审核状态：
			</th>
			<td>
				
				<input type="text" style="width:50%" readonly="true" name="entity.oc_status_name" value="${entity.oc_status_name}" disabled \/>				
				<input type="hidden" style="width:50%" readonly="true" name="entity.oc_status" value="${entity.oc_status}" \/>				
			</td>
			</tr>	
			</s:if>
			
			<tr>		
			<th width="120" nowrap>
						作业名称：
			</th>
			<td>
				
				<input type="text" style="width:100%" datatype="LimitB" size="30" min="0" max="300" msg="作业名称不能超过300个字符" width="100%"  name="entity.oc_zymc" value="${entity.oc_zymc}"  \/>				
				
			</td>
			</tr>
			<tr>
			<th width="120" nowrap>
						工作票号：
			</th>
			<td>
				<input type="text" style="width:50%"   name="entity.oc_gzph"  datatype="LimitB" min="0" max="20" msg="工作票号不能超过20个字符" value="${entity.oc_gzph}"  />	
			</td>			
			<th width="120" nowrap>
						二次工作安全措施票号：
			</th>
			<td>
				<input type="text" style="width:50%"  name="entity.oc_ecgzaqcsph" datatype="LimitB" min="0" max="20" msg="二次工作安全措施票号不能超过20个字符" value="${entity.oc_ecgzaqcsph}"  />	
			</td>
			</tr>			
			</tr>
			<tr>
			<th width="120" nowrap>
						工作负责人：
			</th>
			<td>
				<input type="text" style="width:50%"  datatype="LimitB" min="0" max="20" msg="工作负责人不能超过20个字符"  name="entity.oc_gzfzr"  value="${entity.oc_gzfzr}"  />	
			</td>			
			<th width="120" nowrap>
						成员：
			</th>
			<td>
				<input type="text" style="width:50%"  name="entity.oc_cy" datatype="LimitB" min="0" max="300" msg="成员不能超过300个字符" value="${entity.oc_cy}"  />	
			</td>
			</tr>	
			<tr>
			<th width="120" nowrap>
						工作班组：
			</th>
			<td>
				<input type="text" style="width:50%" datatype="LimitB" min="0" max="200" msg="工作班组不能超过200个字符"  name="entity.oc_gzbz"  value="${entity.oc_gzbz}"  />	
			</td>
			<td colspan="2" nowrap></td>
			</tr>
			<tr>
			<th width="120" nowrap>
						计划工作时间：
			</th>
			<td nowrap>
				<input type="text" readonly="true" maxlength="21" size="21" width="21" onclick="WdatePicker({el:$dp.$('entity.dt_jhgzsjq')})"   name="entity.dt_jhgzsjq"  value='<fmt:formatDate value="${entity.dt_jhgzsjq}" pattern="yyyy-MM-dd HH:mm"/>' />
				<img id="img_con1" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',el:$dp.$('entity.dt_jhgzsjq')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
				至
				<input type="text" readonly="true" maxlength="21" size="21" name="entity.dt_jhgzsjz" onclick="WdatePicker({el:$dp.$('entity.dt_jhgzsjz')})"    value='<fmt:formatDate value="${entity.dt_jhgzsjz}" pattern="yyyy-MM-dd HH:mm"/>' />
				<img id="img_con2" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',el:$dp.$('entity.dt_jhgzsjz')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
			</td>			
			<td colspan="2"></td>
			</tr>			
			</table>			
		
			<table width="100%" id="listtab" class = "leadertab" >	

				<tr>
					<th colspan="2">
					<% if ((session.getAttribute("btn_addgxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
					<img src="<%=contextPath%>/images/add.gif" onclick = "setHTML(this,0)" style="cursor:pointer"/>
					<%} %>
					</th>
					<th>序号</th>
					<th width="20%">工序</th>
					<th width="20%">工艺标准及要求</th>					
					<th width="40%">风险提醒（必要时）</th>
					<th width="40">附件</th>
					<th width="10%">工作状态</th>
					<th width="60">完成时间</th>
					<th width="45">负责人</th>
					
				</tr>
				
				<c:forEach items="${gxzlkzkBZList}" var="cardbz" varStatus="tatus" >
				<tr id = "tr${tatus.index}" class = "repeat">
				<td width="20">
				<c:if test="${cardbz.sortId%2 == 0||(cardbz.sortId+1)%2 == 0}">
				<% if ((session.getAttribute("btn_deletegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
				<img src="<%=contextPath%>/images/add.gif" onclick = "setHTML(this,2)" style="cursor:pointer"/>
				<%} %>
				</c:if>
				</td>
				<td width="30">
				<% if ((session.getAttribute("btn_deletegxk_display") != null || "1".equals(session.getAttribute("SESSION_ISADMIN")))) {%>
				<img src="<%=contextPath%>/images/add.gif" onclick = "setHTML(this,1)" style="cursor:pointer"/>
				<img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,0,${tatus.index})" style="cursor:pointer"/>
				<%} %>
				</td>
				<td>
				<input size="1" type="text" id="aa[${tatus.index}]"  value="${cardbz.sortId}" name="gxzlkzkBZList[${tatus.index}].sortId"  />
				</td>
				<td width="20%">
				<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="工序不能超过2000个字符"  id=oc_gx[${tatus.index}] name="gxzlkzkBZList[${tatus.index}].oc_gx" >${cardbz.oc_gx}</textarea>
				</td >	
				<td width="20%">
				<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="工艺标准及要求不能超过2000个字符"  id=oc_gybzjyq[${tatus.index}] name="gxzlkzkBZList[${tatus.index}].oc_gybzjyq" >${cardbz.oc_gybzjyq}</textarea>
				</td >	
				<td width="40%">
				<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="风险提醒不能超过2000个字符"  id=oc_fxtx[${tatus.index}] name="gxzlkzkBZList[${tatus.index}].oc_fxtx" >${cardbz.oc_fxtx}</textarea>
				</td >	
                <td>
						<c:if test="${cardbz.id_sno != '0'}">
							<img style='cursor:pointer' onclick="filePopup('${cardbz.id_sno}','TAB_GXZLKZK-BZ','0')" alt="打开文件列表" src="<%=contextPath%>/images/userfile.png" >
						</c:if>
						<c:if test="${cardbz.id_sno == '0'}">
							&nbsp;<img style='cursor:pointer' src="<%=contextPath%>/images/redlight.gif"/><font color="red">请保存记录后上传附件</font>
						</c:if>
				</td>				
				<td width="15%" nowrap="nowrap">
				<!-- <select id="oc_gzzt[${tatus.index}]" name="gxzlkzkBZList[${tatus.index}].oc_gzzt" onChange="getSysdateAndFzr(this,'${tatus.index}');">
				<option value="" ${cardbz.oc_gzzt==""?"selected":""}></option>
				<option value="01" ${cardbz.oc_gzzt=="01"?"selected":""}>已完成</option>
				<option value="02" ${cardbz.oc_gzzt=="02"?"selected":""}>正在执行</option>
				<option value="00" ${cardbz.oc_gzzt=="00"?"selected":""}>未执行</option>
				</select> -->
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="gxzlkzkBZList[${tatus.index}].oc_gzzt" value="01" ${cardbz.oc_gzzt=="01"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>已完成
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="gxzlkzkBZList[${tatus.index}].oc_gzzt" value="02" ${cardbz.oc_gzzt=="02"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>正在执行
				<input type="radio" id="oc_gzzt[${tatus.index}]" name="gxzlkzkBZList[${tatus.index}].oc_gzzt" value="00" ${cardbz.oc_gzzt=="00"?"checked":""} onClick="getSysdateAndFzr(this,'${tatus.index}');"/>未执行
				</td >	
				<td width="10">	
				<input size="12" type="text" id="oc_wcsj[${tatus.index}]" readonly value="${cardbz.oc_wcsj}" name="gxzlkzkBZList[${tatus.index}].oc_wcsj"  />
				</td>									
				<td width="10">	
				<input size="3" type="text" id="oc_fzr[${tatus.index}]" readonly value="${cardbz.oc_fzr}" name="gxzlkzkBZList[${tatus.index}].oc_fzr"  />
				</td>
				</tr>
				</c:forEach>
				<%
				List<Gxzlkzk_BZ> gxzlkzk_bz=(List<Gxzlkzk_BZ>)request.getAttribute("gxzlkzkBZList");
				
				if(gxzlkzk_bz!=null&&gxzlkzk_bz.size()!=0){
				%>
				<input type="hidden" id="manylist" value="<%=gxzlkzk_bz.size()%>"/>
				<%}else{%>
				<input type="hidden" id="manylist" value="0"/>
				<%}%>
			</table>
			<table width="100%" border="0" id="listtab">
			<tr>
			<th width="120" nowrap>
						安装评价：
			</th>
			<td>
				<textarea style="width:100%; height: 100px; min-height: 20px;line-height:15pt" name="entity.oc_azpj" >${entity.oc_azpj}</textarea>
			</td>
			</tr>
			</table>
		
   </form>
   </div>
  </body>
</html>
<script language="javascript"><!--
	function lookImage (imgFile){
		
	    var path = imgFile.value;
	    if(path==""){
			return false;
		    }
	    if( !imgFile.value.match( /.jpg|.gif|.png|.bmp/i ) ){        
	       alert('图片格式错误');        
	       return false;        
	   }
	    if( imgFile.files &&  imgFile.files[0] ){        
	        // Firefox 因安全性问题已无法直接通过 input[file].value 获取完整的文件路径        
	        path = imgFile.files[0].getAsDataURL();            
	    } 
	    //解决IE7，IE8由于安全问题不能获取全路径的问题 
	    var isIE = (document.all) ? true : false;
	    var isIE7 = isIE && (navigator.userAgent.indexOf('MSIE 7.0') != -1);
	    var isIE8 = isIE && (navigator.userAgent.indexOf('MSIE 8.0') != -1);
	    if(isIE7 || isIE8){
	        imgFile.select();
	        path=document.selection.createRange().text;
	        document.selection.empty();
	    }
	    $('#myImagequ').empty();
	    $('#myImagequ').append("<img id='myImg' src='"+path+"' style='width:400px;height:300px;text-align:center'/>");	   
	    
	    // IE7,IE8 在设置本地图片地址为 img.src 时出现莫名其妙的后果        
	    //（相同环境有时能显示，有时不显示），因此只能用滤镜来解决    
	   
	 }  
	var usernum=parseInt(document.getElementById("manylist").value);
	function getSysdateAndFzr(obj,num){
	var number=parseInt(num);
	if(obj.value!="01"){
		var_wcsj=eval('document.getElementById("oc_wcsj['+number+']")');
		var_wcsj.value='';
		var_fzr=eval('document.getElementById("oc_fzr['+number+']")');	
		var_fzr.value='';						
	return false;
	}
	Ext.Ajax.request({
						method :'POST',
						url :'gxzlkzk!getSysdateAndFzr.do',						
						success : function(response) {
							//Ext.MessageBox.alert('提示', response.responseText);	
							var data=Ext.decode(response.responseText);
							var_wcsj=eval('document.getElementById("oc_wcsj['+number+']")');
							var_wcsj.value=data.sysdate;
							var_fzr=eval('document.getElementById("oc_fzr['+number+']")');	
							var_fzr.value=data.fzr;							
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '异步失败！');
						}
					});
	}
	// 增加行
	 function setHTML(row,sortType) {
	 var startValue=1;
		 if(sortType==0){
		 	startValue=1;
		 }else if(sortType==1){
		 startValue=1.1;
		 }else if(sortType==2){
		 startValue=1;
		 }
		 
			var str = 	'<tr id = tr'+ usernum +' class = "repeat">' +
			'<td width="20"></td>' + 
			'<td width="30"><img src="<%=contextPath%>/images/delete.gif" onclick = "delrow(this,0)" style="cursor:pointer"/></td>' + 
			'<td>'+'<input size="1" type="text" id="aa['+usernum+']"  value='+startValue+' readonly name="gxzlkzkBZList['+usernum+'].sortId"  />'+			
			'</td>'+
			'<td width="20%">'+
			'<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="工序不能超过2000个字符" id=oc_gx['+usernum+'] name="gxzlkzkBZList['+usernum+'].oc_gx" ></textarea>'+
			'</td >	'+
			'<td width="20%">'+
			'<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="工艺标准及要求不能超过2000个字符" id=oc_gybzjyq['+usernum+'] name="gxzlkzkBZList['+usernum+'].oc_gybzjyq" ></textarea>'+
			'</td >	'+
			'<td width="40%">'+
			'<textarea style="width:100%; height: 25px; min-height: 20px;line-height:15pt" datatype="LimitB" min="0" max="2000" msg="风险提醒不能超过2000个字符"  id=oc_fxtx['+usernum+'] name="gxzlkzkBZList['+usernum+'].oc_fxtx" ></textarea>'+
			'</td >			'+
			'<td width="20"></td>' + 
			'<td width="15%">'+
			'<input type="radio" id="oc_gzzt['+usernum+']" name="gxzlkzkBZList['+usernum+'].oc_gzzt" value="01" onClick="getSysdateAndFzr(this,'+usernum+');"/>已完成'+
			'<input type="radio" id="oc_gzzt['+usernum+']" name="gxzlkzkBZList['+usernum+'].oc_gzzt" value="02" onClick="getSysdateAndFzr(this,'+usernum+');"/>正在执行'+
			'<input type="radio" id="oc_gzzt['+usernum+']" name="gxzlkzkBZList['+usernum+'].oc_gzzt" value="00" onClick="getSysdateAndFzr(this,'+usernum+');"/>未执行'+
			'</td >	'+
			'<td>	'+
			'<input size="12" type="text" id="oc_wcsj['+usernum+']"  value="${cardbz.oc_wcsj}" readonly name="gxzlkzkBZList['+usernum+'].oc_wcsj"  />'+			
			'</td>		' +		
			'<td>	'+
			'<input size="3" type="text" id="oc_fzr['+usernum+']"  value="${cardbz.oc_fzr}" readonly name="gxzlkzkBZList['+usernum+'].oc_fzr"  />'+			
			'</td>		' +				
			'</tr>';
			if(sortType==0){	
			$('#listtab').append(str);	
			}else if(sortType==1){
			$(str).insertAfter($(row).parents(".repeat"));	
			}else if(sortType==2){
			$(str).insertBefore($(row).parents(".repeat"));	
			}
			toSort();
			usernum++;	
			$('textarea').autogrow();
	}
	function toSort() {
		var index = 0;
		var index2 = 0.0;
		$("#listtab").find("[id^='aa']").each(function (i) {
			if (this.value.indexOf(".") == -1) {
				index++;
				this.value = index;
				index2 = 0.0;
			} else {
				if (i == 0) {
					index++;
					this.value = index; 
				} else {
					index2 += 0.1;
					this.value = index + index2;
				}
			}			
		});
	}
	/**function toSort2(delSort) {
		var index = Math.floor(delSort);
		var index2 = 0.0;
		$("#listtab").find("[id^='aa']").each(function (i) {
			if (parseFloat(this.value) < parseFloat(delSort)) {
				//continue;
			}else{
			if (this.value.indexOf(".") == -1) {
				index++;
				this.value = index;
				index2 = 0.0;
			} else {alert(parseFloat(this.value));
				if (parseFloat(this.value) == parseInt(delSort) + 0.1) {
					this.value = index; 
				} else {
					index2 += 0.1;
					this.value = index + index2;
				}
			}	
			}		
		});
	}
	function toSort2(delSort) {
		var index = Math.floor(delSort);
		var index2 = 0.0;
		var flag = false;
		$("#listtab").find("[id^='aa']").each(function (i) {
		
			if (Math.floor(this.value) < Math.floor(delSort)) {
			
			} else if (Math.floor(delSort) == Math.floor(this.value)){
				if (parseFloat(this.value) == parseInt(delSort) + 0.1) {
				    index2 = 0.0;
					this.value = Math.floor(delSort); 
				} else {
					index2 += 0.1;
					this.value = Math.floor(delSort) + index2;
				}
				flag = true;
			} else {
				if (this.value.indexOf(".") == -1) {
					if (flag == false) {
						index++;
					} else {
						index = this.value;
					}
					this.value = index;
					index2 = 0.0;
				} else {
					index2 += 0.1;
					this.value = index + index2;
				}	
			}		
		});
	}*/


function toSort2(delSort) {// 1,2,2.1,2.2,3,3.1,4,5
		var index = Math.floor(delSort);
		var index2 = 0.0;
		var flag = false;
		$("#listtab").find("[id^='aa']").each(function (i) {
			// 小于删除的索引
			if (Math.floor(this.value) < Math.floor(delSort)) {
			
			// 整数部分 == 删除的索引的整数部分
			} else if (Math.floor(delSort) == Math.floor(this.value)){
			
				// 。1时
				if (parseFloat(this.value) == parseInt(delSort) + 0.1) {
				    index2 = 0.0;
					this.value = Math.floor(delSort); 
					// 整数时
				} else if (this.value.indexOf('.') == -1) {
					index2 = 0.0;
					this.value = Math.floor(delSort); 
					// 其他
				} else {
					index2 += 0.1;
					this.value = Math.floor(delSort) + index2;
				}
				flag = true;
			} else {
				if (this.value.indexOf(".") == -1) {
					if (flag == false) {
						index = this.value - 1;
					} else {
						index = this.value;
					}
					this.value = index;
					index2 = 0.0;
				} else {
					index2 += 0.1;
					this.value = index + index2;
				}	
			}		
		});
	}

	
	//删除班组作业控制卡（一种票）
	function toSeeRwd(id){
		
			if(!isChecked("id")) {
		 		alert("请选择一条记录");
		 		return false;
		 	}
 
		 	id1 = getCheckValue("id");//获取id值
			
		alert(id1);
   
				}

		
		//删除一行（已有数据）
	  function delrow(row,id,index){
	    //alert(index);
	    if(index!=undefined){
	     var sortid=document.getElementById('aa['+index+']').value;
	       // alert(sortid);
	     }
			if (confirm("确定要删除该条记录吗？")) {
				if(id != 0) {
					Ext.Ajax.request({
						method :'POST',
						url :'gxzlkzk!deleteBz.do?id=' + id,
						params : {},
						success : function(response, options) {
							var obj = Ext.decode(response.responseText);
							Ext.MessageBox.alert('提示', obj["msg"]);
						
		   					$(row).parents(".repeat").remove();	
	 
						},
						failure : function(response, options) {
							Ext.MessageBox.alert('提示 ', '删除失败。');
						}
					});
				} else {
					$(row).parents(".repeat").remove();	
					if(index!=undefined){
					toSort2(sortid);
					//toSort();
					}
				}
	 
			}
	 
		} 		
	 // 保存
     function comt(){
        if(!Validator.Validate(frmM,1)){
			return false;
		}
     	document.frmM.action = "<%=contextPath%>/gxzlkzk!saveGxzlkzk.do?directFlag=NEW_GXZLKZK";
		//document.frmM.action = "<%=contextPath%>/jsp/sys/gzzbTab.jsp?src=workcardOne!addWorkcardOne.do";
     	document.frmM.submit();
     }
     // 刷新
     function refresh(bzgsids){
     //alert(bzgsids);
     	document.frmM.action = "<%=contextPath%>/gxzlkzk!updateGxzlkzk.do?bzgsids=" + bzgsids;
		document.frmM.submit();
     }
     // 典型工序卡刷新
     function refreshModel(modelids){
     //alert(modelids);
     	document.frmM.action = "<%=contextPath%>/gxzlkzk!updateGxzlkzk.do?modelids=" + modelids;
		document.frmM.submit();
     }
     // 返回
     function back() {
       // window.parent.window.location.href = "<%=contextPath%>/jsp/business/workcard/gzzbTab.jsp?src=gxzlkzkList!getList.do";
		//window.parent.window.location.href = "<%=contextPath%>/workcardOneList!getList.do?da="+date();
        document.frmM.action = "<%=contextPath%>/gxzlkzkList!getList.do";
		document.frmM.submit();
		
     }

 // 附件列表
	 function filePopup(id,colname,imageflag) {
		 var url = "<%=contextPath%>/jsp/common/fileTab.jsp?tableid=" + id + "&colname="+colname+"&imageflag="+imageflag;// "<%=contextPath%>/sb!test.do?id="+id;
		 var win = window.open(url,"图片列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	}
		// 批准, 审核
		function toConfirm(flag)
		{
		
				var msg = flag == '1' ? '提交':'审核通过';
				
		    	if(confirm("确定要" + msg + "选中的记录吗？")) {
		        	document.frmM.action = "<%=contextPath%>/plan!saveMonthPlan.do?flag=" + flag;
					document.frmM.submit();
		    	}
		}
		// 起草计划班组工作任务
		function toNewRwd(paramBzid,paramPlanid){
		//window.alert(paramBzid);window.alert(paramPlanid);
		// 打开窗口
		//parent.addTab("班组工作任务", "<%=contextPath%>/jsp/business/plan/bzgzrw.jsp?paramBzid="+paramBzid+"&paramPlanid="+paramPlanid, paramBzid);
    var url = "<%=contextPath%>/jsp/business/plan/bzgzrw.jsp?paramBzid="+paramBzid+"&paramPlanid="+paramPlanid;
		 var win = window.open(url,"计划任务列表","left=450,top=30,width=850,height=500,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	
				}
				// 标准工时库标准作业选择
		function toNewGx(){
		  var url = "<%=contextPath%>/jsp/business/workcard/bzgsk.jsp";
		 var win = window.open(url,"标准工时库标准作业选择","left=150,top=30,width=1084,height=568,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	
				}
				// 另存为进入详细页面
			function copy(){
				var id="${entity.id_sno}";
				parent.addTab("工序质量控制卡", "<%=contextPath%>/gxzlkzk!initDetail.do?id="+id,id+1+"copy");
	    
			}
			// 典型工序质量控制卡选择
		function toNewModel(){
		  var url = "<%=contextPath%>/jsp/business/workcard/modelgxk.jsp";
		 var win = window.open(url,"典型工序质量控制卡选择","left=150,top=30,width=1084,height=568,status=no,toolbar=no,autoscroll=yes,location=no,menubar=no,resizable=yes",true);
	
				}
		function func_model(){			
		    	if(confirm("确定要另存为典型工序质量控制卡模版吗？")) {
		        	document.frmM.action = "<%=contextPath%>/gxzlkzk!updateModel.do";
					document.frmM.submit();
		    	}
			}
--></script>
